package com.cartoon.adapter;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;


import androidx.annotation.Nullable;

import com.blankj.utilcode.util.LogUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.MemoryCategory;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.cartoon.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tencent.smtt.export.external.interfaces.WebResourceError;
import com.tencent.smtt.export.external.interfaces.WebResourceRequest;
import com.tencent.smtt.sdk.CookieManager;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;


import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import model.CarttonKKContentModel;
import pic.PicLoadManager;

public class LRYCarttonReadingContentAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public LRYCarttonReadingContentAdapter(int layoutResId, @Nullable @org.jetbrains.annotations.Nullable List<String> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {


//        ImageView pic = helper.itemView.findViewById(R.id.iv_reding);
//
//
//        Glide.with(helper.itemView.getContext())
//                .load(item)
//
//
////                .diskCacheStrategy(DiskCacheStrategy.ALL)
//                .into(pic);


        LogUtils.d("我的是分散开A" + item);
        WebView webView = helper.itemView.findViewById(R.id.webView);


        webView.stopLoading();


        // 启用缩放
        webView.getSettings().setSupportZoom(true);
        // 设置默认缩放比例
//        webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
        // 设置WebView加载页面时缩小图片
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        webView.setVerticalScrollBarEnabled(true);
        webView.setHorizontalScrollBarEnabled(false);


        // 启用WebView硬件加速
        webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);

        webView.loadUrl(item);


    }
}
